<template>
  <div>
    <Form layout="inline">
      <FormItem label="用户组名称">
        <Input v-model:value="name" style="width: 200px" placeholder="请输入"></Input>
      </FormItem>
      <FormItem label="授权策略">
        <Select
          v-model:value="policyIdList"
          :options="policyOptions"
          style="width: 200px"
          mode="multiple"
          placeholder="请选择"
        ></Select>
      </FormItem>
      <FormItem label="排班状态">
        <Select
          v-model:value="isScheduled"
          :options="isScheduledOpts"
          style="width: 200px"
          placeholder="请选择"
        ></Select>
      </FormItem>
      <div>
        <Tooltip title="查询">
          <Button type="primary" @click="search" shape="circle"
            ><template #icon><SearchOutlined /></template
          ></Button>
        </Tooltip>
        <Tooltip title="重置">
          <Button style="margin-left: 10px" @click="reset" shape="circle"
            ><template #icon><ReloadOutlined /></template
          ></Button>
        </Tooltip>
      </div>
    </Form>
  </div>
</template>
<script lang="ts" setup>
import { Tooltip, Form, FormItem, Select, Button, Input } from 'ant-design-vue';
import { SearchOutlined, ReloadOutlined } from '@ant-design/icons-vue';
import { ref } from 'vue';

// import { getAuthPolicyList } from '/@/api/work-order/userManagement/userGroup/userGroup';
const name = ref();
const policyIdList = ref([]);
const policyOptions = ref();
const isScheduled = ref();
let isScheduledOpts = [
  { label: '已排班', value: true },
  { label: '未排班', value: false },
];

// policyOptions.value=await getAuthPolicyList();
const getPolicyList = async () => {
  policyOptions.value = [
    { label: 'bbbbb', value: 'bbbbb' },
    { label: 'ccccc', value: 'ccccc' },
  ];
};
getPolicyList();

const emit = defineEmits(['get']);
let searchParam = {
  isScheduled: isScheduled.value,
  policyIdList: policyIdList.value,
  name: name.value,
};
const search = () => {
  emit('get', searchParam);
};

const reset = () => {
  policyIdList.value = [];
  name.value = undefined;
  isScheduled.value = [];
  searchParam = {
    isScheduled: isScheduled.value,
    policyIdList: policyIdList.value,
    name: name.value,
  };
  emit('get', searchParam);
};
</script>
